package com.letoken.platform.repo.ecommerce.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.ObjectUtils;

import java.math.BigDecimal;

@Data
public class RefundDto {
    // 是否未退货退款
    private Boolean isRefundGoods = false;

    // 订单ID
    private Integer id;

    // 售后订单ID
    private Integer afterId;

    // 商户ID
    private Integer userId;
    // 退款金额
    private BigDecimal amount;
    // 用户ID
    private Integer toUserId;
    // 商户账户ID
    private Integer accountId;
    // 用户钱包ID
    private Integer walletId;


    private BigDecimal payAmount ;


    private BigDecimal contributing;

    private String orderNo;

    private BigDecimal shipping;

    private Boolean needRefundShipping;
    private Integer payType;
    // 是否为最后一笔
    private Boolean last;

    public RefundDto(Integer id , Integer afterId, Integer userId, BigDecimal amount, Integer toUserId,Boolean isRefundGoods,BigDecimal payAmount,BigDecimal contributing,String orderNo,BigDecimal shipping) {
        this.id = id ;
        this.afterId = afterId;
        this.userId = userId;
        this.amount = amount;
        this.toUserId = toUserId;
        this.isRefundGoods = isRefundGoods;
        this.payAmount = payAmount;
        this.contributing = contributing;
        if (ObjectUtils.isEmpty(payAmount)){
            this.payAmount = BigDecimal.ZERO;
        }
        this.needRefundShipping = false;
        this.orderNo = orderNo;
        this.shipping = shipping;
    }


    public RefundDto(Integer id , Integer afterId, Integer userId, BigDecimal amount, Integer toUserId,Boolean isRefundGoods,BigDecimal payAmount,BigDecimal contributing,String orderNo,BigDecimal shipping,Boolean last) {
        this.id = id ;
        this.afterId = afterId;
        this.userId = userId;
        this.amount = amount;
        this.toUserId = toUserId;
        this.isRefundGoods = isRefundGoods;
        this.payAmount = payAmount;
        this.contributing = contributing;
        if (ObjectUtils.isEmpty(payAmount)){
            this.payAmount = BigDecimal.ZERO;
        }
        if (ObjectUtils.isEmpty(needRefundShipping)){
            this.needRefundShipping = false;
        }
        this.last = last;
        if (ObjectUtils.isEmpty(last)){
            this.last = false;
        }
        this.orderNo = orderNo;
        this.shipping = shipping;
    }



    public RefundDto(Integer id , Integer afterId, Integer userId, BigDecimal amount, Integer toUserId,Boolean isRefundGoods,BigDecimal payAmount,BigDecimal contributing,String orderNo,BigDecimal shipping,Boolean needRefundShipping,Boolean last,Integer payType) {
        this.id = id ;
        this.afterId = afterId;
        this.userId = userId;
        this.amount = amount;
        this.toUserId = toUserId;
        this.isRefundGoods = isRefundGoods;
        this.payAmount = payAmount;
        this.contributing = contributing;
        this.payType = payType;
        if (ObjectUtils.isEmpty(payAmount)){
            this.payAmount = BigDecimal.ZERO;
        }
        this.needRefundShipping = needRefundShipping;

        if (ObjectUtils.isEmpty(needRefundShipping)){
            this.needRefundShipping = false;
        }
        this.last = last;
        if (ObjectUtils.isEmpty(last)){
            this.last = false;
        }
        this.orderNo = orderNo;
        this.shipping = shipping;
    }
}
